import axios from "axios"
const upload = (path, userForm) => {
  // console.log('submit', userForm)
  // 上传文件需要转化为 FormData 的格式
  const params = new FormData()
  for (let item in userForm) {
    params.append(item, userForm[item])
  }
  return axios.post(path, params, {
    // FormData 文件上传的请求头
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => res.data)
}
export default upload